//package src;

import java.awt.Point;
import java.awt.geom.Point2D;

public class DrawFree extends Order 
{
	
    Point2D.Double point1 = new Point2D.Double();
 private int oldX, oldY, currentX, currentY;	         		

	public void mousePressExe(Point p, Drawing Layer)
	{
		oldX = p.x;
		oldY = p.y;
	}

	public void mouseDragExe(Point p, Drawing Layer, GraphicsObject object1)
	{
		currentX = p.x;		
		currentY = p.y;		
 		ShapeFree free = new ShapeFree(oldX, oldY, currentX, currentY, Layer.getColor());
 		oldX = currentX;
 		oldY = currentY;
 		Layer.add(free);	
 		point1.setLocation((double)currentX, (double)currentY);		// Grabs the current x and y coordinates and saves them in a Point2D object
        object1.addPoint(point1);	
	}
}